<%--
 - Copyright (c) 2009-2011 ETCORE Labs. All rights reserved. 
 - 
 - This software is the confidential and proprietary information of ETCORE Labs. 
 - You shall not disclose such confidential information and shall use it only
 - in accordance with the terms of the license agreement you entered into
 - with ETCORE Labs.
 -
 - Support can be obtained from support forums at:
 - http://www.etcore.com/
 -
 - @author: ETCORE GroupTalk developers
 -
 --%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.etcore.com/grouptalk" prefix="grouptalk"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title><c:out value='${context.reply_templates }' />-<c:out
	value='${context.title}' /></title>

<link rel="stylesheet" href="/group/css/styles.css" type="text/css">
<script language="javascript">
function checkForm1()
{

if(form1.content.value==""||form1.content.value.replace(/(^\s*)|(\s*$)/g, "")=="")
{
alert("<c:out value='${context.msg_content_null}'/>");
form1.content.focus();
return false;
}
if(form1.content.length>15000)
{
alert("<c:out value='${context.msg_content_null}'/>");
form1.content.focus();
return false;
}


return true;
}
function checkForm2()
{

if(form2.name.value==""||form2.name.value.replace(/(^\s*)|(\s*$)/g, "")=="")
{
alert("<c:out value='${context.msg_title_null}'/>");
form2.name.focus();
return false;
}
return true;
}
</script>
</head>


<body bottomMargin=0 leftMargin=10 topMargin=0 onload=preloadImages()
	rightMargin=10 marginheight="0">
<c:set var="groupViewer" value="groupdetail" />
<c:set var="platform" value="platform${group.open}" />
<c:set var="platformLabel" value="${context[platform]}" />
<c:set var="currentViewer" value="groupadmin" />
<c:set var="posturl" value="" />
<c:if test="${group.open==1 }">

	<c:set var="posturl" value="&nav=${group.nav }" />
	<c:if test="${group.nav==1 }">
		<c:set var="platformLabel" value="${context.nav1}" />
	</c:if>
</c:if>
<c:if test="${group.open==2 }">

	<c:if test="${group.nav==1 }">
		<c:set var="platformLabel" value="${context.nav2}" />
	</c:if>
	<c:set var="posturl" value="&nav=${group.nav }" />
</c:if>

<c:if test="${not empty group &&group.open==3}">

	<c:set var="groupViewer" value="bookmarksadmin" />
</c:if>
<TABLE cellSpacing=0 cellPadding=0 width=100% border=0 align=center>
	<%-- //////////////////////banner --%>
	<tr>
		<td><c:import url="/banner.jsp?currentPlatform=0" /></td>
	</tr>
	<tr>
		<td>
		<TABLE cellSpacing=0 cellPadding=0 width=100% border=0 align=center
			style="margin-top: 10px;">
			<TBODY>
				<TR>
					<c:if test="${isAdmin }">

						<td width=120 nowrap valign=top><c:import
							url="/group/adminMenu.jsp?currentPlatform=0&replyTemplates=1" /></td>

					</c:if>
					<TD valign=top>

					<table>
						<tr>
							<td style="margin-left: 15px; color: #808080"><a
								href="/group/groupadmin${context.postfix}"
								style="color: #3B5998">${context.management }</a><c:if
								test="${not empty topic}">-><a
									href="${currentViewer }${context.postfix}?open=${group.open}"
									style="color: #3B5998">${platformLabel }</a>-><a
									style="color: #3B5998"
									href="/group/${groupViewer}${context.postfix }?id=${group.id}">${group.name }</a>-><a
									style="color: #3B5998"
									href="/group/${groupViewer}${context.postfix }?id=${group.id}&tid=${topic.id}">${topic.name
								}</a>->${context.reply_templates}
							</c:if><c:if
								test="${ empty topic}">->${context.public_reply_templates}</c:if></td>
						</tr>


					</table>
					<table   cellspacing=0 cellpadding=0
						style="border: 1px solid #d2d4d2;; margin-top: 10px; margin-left: 20px;">
						<c:set var="replyTemplateCount" value="1" />
						<c:forEach var="replyTemplate" items="${replyTemplates }">
							<c:set var="toUserAvatar"
								value="${replyTemplate.userName}_avatar" />
							<c:url value="viewUser${context.postfix}" var="toUserUrl">
								<c:param name="targetUserName"
									value="${replyTemplate.userName }" />
							</c:url>
							<tr bgcolor=#EDF3E4>
								<td align=center valign=top width=35><a
									style="font-size: 12px; color: #005EAC"
									href="/group/${toUserUrl }"><c:if
									test="${not empty requestScope[toUserAvatar]&&fn:indexOf(requestScope[toUserAvatar],'upload')!=-1 }">
									<img src="${requestScope[toUserAvatar]}"
										style="margin-left: 5px; margin-right: 5px;" width=26 border=0 />
								</c:if><c:if
									test="${empty requestScope[toUserAvatar]||fn:indexOf(requestScope[toUserAvatar],'upload')==-1 }">
									<img src="/group/images/avatar/avatar.jpg"
										style="margin-left: 5px; margin-right: 5px;" width=26 border=0 />
								</c:if></a></td>
								<td valign=top height=45 align=left nowrap
									style="font-size: 12px; color: #808080"><a
									style="font-size: 12px; color: #005EAC"
									href="/group/${toUserUrl }"><c:out
									value="${replyTemplate.userName }" /></a>&nbsp; <c:out
									value="${replyTemplate.addtime }" />&nbsp;<c:out
									value="${context.text_reply }" />：<br />
								<c:out value='${replyTemplate.content }' escapeXml="false" /></td>

								<td align=right width=100%><c:out
									value="${replyTemplateCount}" /><c:set
									var="replyTemplateCount" value="${replyTemplateCount+1 }" /> <c:if
									test="${isAdmin||replyTemplate.userName eq session_user.userName }">
									<a
										href="/group/replyTemplates<c:out value='${context.postfix }' />?cmd=del&id=${replyTemplate.id }&tid=${param.tid}"
										onclick='if(window.confirm("<c:out value='${context.msg_del_now }' />")){return true;}else{return false;}'><img
										src="/group/images/button_delete.gif" valign=bottom width="17"
										height="17" alt="<c:out value='${context.text_del }' />..."
										border="0"></a>
								</c:if></td>
							</tr>

							<tr>
								<td colspan=3>&nbsp;</td>
							</tr>
						</c:forEach>
						<tr bgcolor="#ffffff">
							<td colspan=3 align=right><c:set var="pid"
								value="${startpid }" /> <c:forEach begin="${startpid }"
								end="${endpid }" step="1">

								<c:set var="url"
									value="/group/replyTemplates${context.postfix}?pageid=${pid}&tid=${param.tid}" />

								<a
									<c:if test='${intpageid==pid }'> style="font-weight:bold;color:red;"</c:if>
									href="${url }">[<c:out value='${pid}' />]</a>


								<c:set var="pid" value="${pid+1 }" />
&nbsp;&nbsp;</c:forEach> <c:if test="${intpageid>1 }">

								<c:set var="url"
									value="/group/replyTemplates${context.postfix}?pageid=${intpageid-1}&tid=${param.tid}" />

								<a href="${url }"> [<c:out value='${context.previous_page}' />]
								</a>
									 
							 
&nbsp;
</c:if> <c:if test="${intpageid<pagenums }">
								<c:set var="url"
									value="/group/replyTemplates${context.postfix}?pageid=${intpageid+1}&tid=${param.tid}" />
								<a href="${url }"> [<c:out value='${context.next_page}' />]
								</a>
								 
									 
&nbsp;
</c:if></td>
						</tr>
						<tr>
							<td></td>
						</tr>

						<tr>
							<td colspan=3 align=center>
							<div id=commentControl
								style="display: block; valign: center; padding: 0px; background-color: white; z-index: 1002; overflow: hidden;">
							<form name="form1" onSubmit="return checkForm1();" method=post
								action="/group/replyTemplates<c:out value='${context.postfix }' />">
							<input type=hidden name=cmd value="add"> <c:if
								test="${not empty param.tid }">
								<input type=hidden name=tid value="${param.tid }">
							</c:if>
							<table width=650 cellspacing=0 cellpadding=0 border=0>



								<tr>
									<td></td>
									<td></td>
								</tr>
								<tr bgcolor="#f8f8f8">

									<td valign=top width=40 align=center><c:if
										test="${not empty session_user.avatar&&fn:indexOf(session_user.avatar,'upload')!=-1 }">
										<img src="${session_user.avatar}"
											style="margin-left: 5px; margin-right: 5px;" width=26
											border=0 />
									</c:if><c:if
										test="${empty session_user.avatar||fn:indexOf(session_user.avatar,'upload')==-1 }">
										<img src="/group/images/avatar/avatar.jpg"
											style="margin-left: 5px; margin-right: 5px;" width=26
											border=0 />
									</c:if></td>
									<TD width=100%><textarea id="tests2" name="content"
										cols="50" rows="7 "></textarea></TD>
								</TR>

								<tr bgcolor="#f8f8f8">

									<TD align=center colspan=2><input type=submit
										style="cursor: pointer;"
										value="<c:out value='${context.text_comment}'/>"></TD>
								</TR>


							</table>
							</form>
							</div>
							</td>
						</tr>

					</table>
					</TD>
				</TR>
			</TBODY>
		</TABLE>
		</td>
	</tr>
</TABLE>
</body>